<!DOCTYPE html>
<html lang="en-US">
    <head>
        <title>Term::ReadKey - A perl module for simple terminal control - metacpan.org</title>
        <link rel="preload" as="fetch" href="https://metacpan.org/account/login_status" crossorigin="anonymous" />
        <link href="https://metacpan.org/_assets/b8ccceeed47a0652049703d99326a9cea4933443.css" rel="stylesheet" type="text/css">
        <script src="https://metacpan.org/_assets/6bfedafe2d7caa915b7d84f61b45936818e3242e.js" type="text/javascript" defer></script>
        <link rel="alternate" type="application/rss+xml" title="Recent CPAN Uploads of TermReadKey - MetaCPAN" href="https://metacpan.org/dist/TermReadKey/releases.rss" />
        <link rel="canonical" href="./Term::ReadKey.html" />
        <meta name="description" content="A perl module for simple terminal control" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
        <link rel="shortcut icon" href="https://metacpan.org/static/icons/favicon.ico">
        <link rel="apple-touch-icon" sizes="152x152" href="https://metacpan.org/static/icons/apple-touch-icon.png">
        <link rel="search" href="https://metacpan.org/static/opensearch.xml" type="application/opensearchdescription+xml" title="MetaCPAN">
        <script>
          (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
          (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
          })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

          (function(skey, ga_id){
            ga('create', ga_id, {
              siteSpeedSampleRate : 100,
              storage             : 'none',
              clientId            : localStorage.getItem(skey)
            });
            ga(function(tracker) {
              localStorage.setItem(skey, tracker.get('clientId'));
            });
            ga('send', 'pageview');
          })('ga:clientId', 'UA-27829474-1');
        </script>
<meta name="twitter:card"        content="summary" />
<meta name="twitter:url"         content="https://metacpan.org/pod/Term::ReadKey" />
<meta name="twitter:title"       content="Term::ReadKey" />
<meta name="twitter:description" content="A perl module for simple terminal control" />
<meta name="twitter:site"        content="metacpan" />
    </head>
    <body>
        <nav class="navbar navbar-default" role="navigation">
            <div class="header-logo-large hidden-xs">
              <a href="https://metacpan.org/" tabindex="0">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#logo" />
                </svg>
              </a>
            </div>
            <div class="header-logo-icon visible-xs">
              <a href="https://metacpan.org/">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#dots" />
                </svg>
              </a>
            </div>
            <ul class="nav navbar-nav menu-items hidden-xs hidden-sm">
              <li><a href="https://metacpan.org/about">About</a></li>
              <li><a href="https://metacpan.org/about/sponsors">Sponsor</a></li>
              <li><a href="https://grep.metacpan.org/">grep::cpan</a></li>
              <li><a href="https://metacpan.org/recent">Recent</a></li>
              <li><a href="https://metacpan.org/about/faq">FAQ</a></li>
              <li><a href="https://metacpan.org/tools">Tools</a></li>
              <li><a href="https://fastapi.metacpan.org/">API</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <button type="button" class="searchbar-btn visible-xs visible-sm">
                    <i class="fa fa-search button-fa-icon"></i>
                </button>
                <form action="https://metacpan.org/search" class="searchbar-form visible-md visible-lg search-form form-horizontal">
                   <input type="hidden" name="size" id="metacpan_search-size" value="20">
                  <div class="form-group">
                      <div class="search-group">
                        <i class="fa fa-search"></i>
                        <input type="text" name="q" placeholder="Search the CPAN" size="41" autocorrect="off" autocapitalize="off" spellcheck="false" id="metacpan_search-input" class="form-control" value="">
                      </div>
                  </div>
                </form>
                    <li class="icon-slidepanel visible-xs visible-sm">
                      <button data-toggle="slidepanel" data-target=".slidepanel">
                        <span class="button-fa-icon">
                          <i class="fa fa-bars slidepanel-open"></i>
                          <i class="fa fa-times slidepanel-close"></i>
                        </span>
                      </button>
                    </li>
                <form action="https://metacpan.org/account/logout" method="POST" id="metacpan-logout"></form>
                <li class="dropdown logged_in" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon logged-in-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="https://metacpan.org/account/identities">Identities</a></li>
                        <li><a href="https://metacpan.org/account/profile">Profile</a></li>
                        <li><a href="https://metacpan.org/account/favorite/list">Favorites</a></li>
                        <li>
                            <a href="./Term::ReadKey.html#" type="button" onclick="$('#metacpan-logout').submit(); return false">
                              Logout
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_out" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li>
                            <a href="https://metacpan.org/login/github">
                                <i class="fab fa-github fa-fw"></i>
                                GitHub
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/twitter">
                                <i class="fab fa-twitter fa-fw"></i>
                                Twitter
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/google">
                                <i class="fab fa-google fa-fw"></i>
                                Google
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_placeholder">
                    <button>
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                    </button>
                </li>
            </ul>
        </nav>
        <div class="page-content ">
          <!--
          <div class="top-notify-banner">
            <i class="fas fa-info-circle"></i>
          </div>
          -->
          <nav class="sidebar">
            <div class="slidepanel">
              <ul class="nav-list ">
    <li class="nav-header no-margin-top">
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The date that this version of TermReadKey was released.">
      <span class="relatize">05 Jan 2019 11:57:09 UTC</span>
    </li>
  <li>
    Distribution: <a href="https://metacpan.org/dist/TermReadKey">TermReadKey</a>
  </li>
  <li>
    Module version: 2.38
  </li>
  <li>
    <a data-keyboard-shortcut="g s" href="https://metacpan.org/dist/TermReadKey/source/ReadKey.pm.PL">Source</a>
    (<a href="https://metacpan.org/dist/TermReadKey/source/ReadKey.pm.PL?raw=1">raw</a>)
  </li>
  <li>
    <a data-keyboard-shortcut="g b" href="https://metacpan.org/dist/TermReadKey/source">Browse</a>
    (<a href="https://metacpan.org/dist/TermReadKey/source?raw=1">raw</a>)
  </li>
    <li>
      <a data-keyboard-shortcut="g c" href="https://metacpan.org/dist/TermReadKey/changes">Changes</a>
    </li>
    <li>
      <a class="nopopup" href="https://metacpan.org/dist/TermReadKey/contribute">How to Contribute</a>
    </li>
    <li>
        <a rel="noopener nofollow" data-keyboard-shortcut="g r" href="https://github.com/jonathanstowe/TermReadKey">Repository</a>
    </li>
    <li>
      <a rel="noopener nofollow" data-keyboard-shortcut="g i" href="https://rt.cpan.org/Public/Dist/Display.html?Name=TermReadKey">Issues</a>
      (8)
    </li>
    <li>
      <a rel="noopener nofollow" href="http://matrix.cpantesters.org/?dist=TermReadKey+2.38" title="Matrix">Testers</a>
        <span title="(pass / fail / na)">(<a rel="noopener nofollow" href="https://www.cpantesters.org/distro/T/TermReadKey.html?oncpan=1&amp;distmat=1&amp;version=2.38&amp;grade=2" style="color: #090">13717</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/T/TermReadKey.html?oncpan=1&amp;distmat=1&amp;version=2.38&amp;grade=3" style="color: #900">3</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/T/TermReadKey.html?oncpan=1&amp;distmat=1&amp;version=2.38&amp;grade=4">0</a>)</span>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpants.cpanauthors.org/release/JSTOWE/TermReadKey-2.38">Kwalitee</a>
    </li>
    <li>
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The # people with an indexing permission on TermReadKey who have released something to CPAN in the last 2 years (i.e. the # people likely able to release critical fixes in a timely manner)">
      Bus factor: 1
      </div>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpancover.com/latest/TermReadKey-2.38/index.html">5.47% Coverage </a>
    </li>
    <li>
      License: perl_5
    </li>
    <li class="nav-header">Activity</li>
    <li>
<div class="activity-graph">
    <img src="https://metacpan.org/dist/TermReadKey/activity.svg?res=month" />
    <div class="comment">24 month</div>
</div>
    </li>
    <li class="nav-header">Tools</li>
    <li>
      <a itemprop="downloadUrl" href="https://cpan.metacpan.org/authors/id/J/JS/JSTOWE/TermReadKey-2.38.tar.gz">
      Download (<span itemprop="fileSize">83.17KB</span>)</a>
    </li>
    <li>
      <a href="https://explorer.metacpan.org/?url=%2Fmodule%2FJSTOWE%2FTermReadKey-2.38%2FReadKey.pm.PL">
        MetaCPAN Explorer
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/TermReadKey/permissions">
        Permissions
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/TermReadKey/releases.rss">
        Subscribe to distribution
      </a>
    </li>
    <li>
      <button class="btn btn-link" data-toggle="modal" data-target="#metacpan_install-instructions-dialog">
        Install Instructions
      </button>
    </li>
    <li>
      <form action="https://metacpan.org/search">
        <input type="hidden" name="q" value="dist:TermReadKey">
        <input type="search" name="q" placeholder="Search distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
      </form>
    </li>
    <li>
      <form action="https://grep.metacpan.org/search">
        <input type="hidden" name="qd" value="TermReadKey">
        <input type="hidden" name="source" value="metacpan">
        <input type="search" name="q" placeholder="grep distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
     </form>
    </li>
    <li class="version-jump">
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/ReadKey.pm.PL&#39;" class="form-control tool-bar-form">
  <option disabled selected>Jump to version</option>
<option
  
  value="RURBAN/TermReadKey-2.38_03"
>2.38_03 DEV
  (RURBAN on 2019-06-17)</option>
<option
  disabled
  value="JSTOWE/TermReadKey-2.38"
>2.38
  (JSTOWE on 2019-01-05)</option>
<option
  
  value="JSTOWE/TermReadKey-2.37"
>2.37
  (JSTOWE on 2016-10-07)</option>
<option
  
  value="JSTOWE/TermReadKey-2.36"
>2.36
  (JSTOWE on 2016-10-07)</option>
<option
  
  value="JSTOWE/TermReadKey-2.35"
>2.35
  (JSTOWE on 2016-10-06)</option>
<option
  
  value="JSTOWE/TermReadKey-2.34"
>2.34
  (JSTOWE on 2016-10-06)</option>
<option
  
  value="JSTOWE/TermReadKey-2.33"
>2.33
  (JSTOWE on 2015-06-04)</option>
<option
  
  value="STSI/TermReadKey-2.30.02"
>2.30.02
  (STSI on 2011-02-07)</option>
<option
  
  value="STSI/TermReadKey-2.30.01"
>2.30.01
  (STSI on 2008-06-24)</option>
<optgroup label="BackPAN">'
<option
  
  value="JSTOWE/TermReadKey-2.32"
>2.32
  (JSTOWE on 2014-05-10)</option>
<option
  
  value="JSTOWE/TermReadKey-2.31"
>2.31
  (JSTOWE on 2013-10-26)</option>
<option
  
  value="JSTOWE/TermReadKey-2.30"
>2.30
  (JSTOWE on 2005-01-12)</option>
<option
  
  value="JSTOWE/TermReadKey-2.21"
>2.21
  (JSTOWE on 2002-07-28)</option>
<option
  
  value="JSTOWE/TermReadKey-2.20"
>2.20
  (JSTOWE on 2002-05-24)</option>
<option
  
  value="JSTOWE/TermReadKey-2.19"
>2.19
  (JSTOWE on 2002-03-21)</option>
<option
  
  value="JSTOWE/TermReadKey-2.18"
>2.18
  (JSTOWE on 2002-02-10)</option>
<option
  
  value="JSTOWE/TermReadKey-2.17"
>2.17
  (JSTOWE on 2002-01-25)</option>
<option
  
  value="JSTOWE/TermReadKey-2.16"
>2.16
  (JSTOWE on 2001-11-29)</option>
<option
  
  value="JSTOWE/TermReadKey-2.15"
>2.15
  (JSTOWE on 2001-11-07)</option>
<option
  
  value="KJALB/TermReadKey-2.14"
>2.14
  (KJALB on 1999-03-29)</option>
<option
  
  value="KJALB/TermReadKey-2.13"
>2.13
  (KJALB on 1999-03-24)</option>
<option
  
  value="KJALB/TermReadKey-2.12"
>2.12
  (KJALB on 1998-01-07)</option>
<option
  
  value="KJALB/TermReadKey-2.11"
>2.11
  (KJALB on 1997-12-14)</option>
<option
  
  value="KJALB/TermReadKey-2.09"
>2.09
  (KJALB on 1997-10-07)</option>
<option
  
  value="KJALB/TermReadKey-2.08"
>2.08
  (KJALB on 1997-10-06)</option>
<option
  
  value="KJALB/TermReadKey-2.07"
>2.07
  (KJALB on 1997-01-27)</option>
<option
  
  value="KJALB/TermReadKey-2.06"
>2.06
  (KJALB on 1996-11-26)</option>
<option
  
  value="KJALB/TermReadKey-2.05"
>2.05
  (KJALB on 1996-03-14)</option>
<option
  
  value="KJALB/TermReadKey-2.04"
>2.04
  (KJALB on 1995-10-11)</option>
<option
  
  value="KJALB/TermReadKey-2.03"
>2.03
  (KJALB on 1995-09-29)</option>
</optgroup>
</select>
    </li>
    <li class="version-diff">
<select onchange="document.location.href='/release/JSTOWE/TermReadKey-2.38/diff/' + encodeURIComponent(this.value) + '/ReadKey.pm.PL'
" class="form-control tool-bar-form">
  <option disabled selected>Diff with version</option>
<option
  
  value="RURBAN/TermReadKey-2.38_03"
>2.38_03 DEV
  (RURBAN on 2019-06-17)</option>
<option
  disabled
  value="JSTOWE/TermReadKey-2.38"
>2.38
  (JSTOWE on 2019-01-05)</option>
<option
  
  value="JSTOWE/TermReadKey-2.37"
>2.37
  (JSTOWE on 2016-10-07)</option>
<option
  
  value="JSTOWE/TermReadKey-2.36"
>2.36
  (JSTOWE on 2016-10-07)</option>
<option
  
  value="JSTOWE/TermReadKey-2.35"
>2.35
  (JSTOWE on 2016-10-06)</option>
<option
  
  value="JSTOWE/TermReadKey-2.34"
>2.34
  (JSTOWE on 2016-10-06)</option>
<option
  
  value="JSTOWE/TermReadKey-2.33"
>2.33
  (JSTOWE on 2015-06-04)</option>
<option
  
  value="STSI/TermReadKey-2.30.02"
>2.30.02
  (STSI on 2011-02-07)</option>
<option
  
  value="STSI/TermReadKey-2.30.01"
>2.30.01
  (STSI on 2008-06-24)</option>
<optgroup label="BackPAN">'
<option
  
  value="JSTOWE/TermReadKey-2.32"
>2.32
  (JSTOWE on 2014-05-10)</option>
<option
  
  value="JSTOWE/TermReadKey-2.31"
>2.31
  (JSTOWE on 2013-10-26)</option>
<option
  
  value="JSTOWE/TermReadKey-2.30"
>2.30
  (JSTOWE on 2005-01-12)</option>
<option
  
  value="JSTOWE/TermReadKey-2.21"
>2.21
  (JSTOWE on 2002-07-28)</option>
<option
  
  value="JSTOWE/TermReadKey-2.20"
>2.20
  (JSTOWE on 2002-05-24)</option>
<option
  
  value="JSTOWE/TermReadKey-2.19"
>2.19
  (JSTOWE on 2002-03-21)</option>
<option
  
  value="JSTOWE/TermReadKey-2.18"
>2.18
  (JSTOWE on 2002-02-10)</option>
<option
  
  value="JSTOWE/TermReadKey-2.17"
>2.17
  (JSTOWE on 2002-01-25)</option>
<option
  
  value="JSTOWE/TermReadKey-2.16"
>2.16
  (JSTOWE on 2001-11-29)</option>
<option
  
  value="JSTOWE/TermReadKey-2.15"
>2.15
  (JSTOWE on 2001-11-07)</option>
<option
  
  value="KJALB/TermReadKey-2.14"
>2.14
  (KJALB on 1999-03-29)</option>
<option
  
  value="KJALB/TermReadKey-2.13"
>2.13
  (KJALB on 1999-03-24)</option>
<option
  
  value="KJALB/TermReadKey-2.12"
>2.12
  (KJALB on 1998-01-07)</option>
<option
  
  value="KJALB/TermReadKey-2.11"
>2.11
  (KJALB on 1997-12-14)</option>
<option
  
  value="KJALB/TermReadKey-2.09"
>2.09
  (KJALB on 1997-10-07)</option>
<option
  
  value="KJALB/TermReadKey-2.08"
>2.08
  (KJALB on 1997-10-06)</option>
<option
  
  value="KJALB/TermReadKey-2.07"
>2.07
  (KJALB on 1997-01-27)</option>
<option
  
  value="KJALB/TermReadKey-2.06"
>2.06
  (KJALB on 1996-11-26)</option>
<option
  
  value="KJALB/TermReadKey-2.05"
>2.05
  (KJALB on 1996-03-14)</option>
<option
  
  value="KJALB/TermReadKey-2.04"
>2.04
  (KJALB on 1995-10-11)</option>
<option
  
  value="KJALB/TermReadKey-2.03"
>2.03
  (KJALB on 1995-09-29)</option>
</optgroup>
</select>
    </li>

    <li>
<ul class="dependencies">
  <li class="nav-header">Dependencies</li>
  <li><i class="ttip" title="dynamic_config enabled">unknown</i></li>
  <li>
    <hr>
  </li>
  <li>
    <a href="https://metacpan.org/module/Term::ReadKey/requires">Reverse dependencies</a>
  </li>
  <li>
    <a href="http://deps.cpantesters.org/?module=Term%3A%3AReadKey">CPAN Testers List</a>
  </li>
  <li>
    <a href="https://cpandeps.grinnz.com/?dist=TermReadKey">Dependency graph</a>
  </li>
</ul>
    </li>
    <li class="nav-header">Permalinks</li>
    <li>
      <a href="https://metacpan.org/release/JSTOWE/TermReadKey-2.38/view/ReadKey.pm.PL">This version</a>
    </li>
    <li>
      <a href="./Term::ReadKey.html">Latest version</a>
    </li>
    <li>
<div class="plussers">
<div class="nav-header">++ed by:</div>
<div>
<a class="display-all" href="https://metacpan.org/author/DOHERTY"><img src="https://www.gravatar.com/avatar/9533c36b6385c8321bad636c98e9c0a8?d=identicon&amp;s=20" title="DOHERTY" alt="DOHERTY"></a>
<a class="display-all" href="https://metacpan.org/author/FANY"><img src="https://www.gravatar.com/avatar/7bc0edaceda1cb0a5b56b844a5b406c2?d=identicon&amp;s=20" title="FANY" alt="FANY"></a>
<a class="display-all" href="https://metacpan.org/author/NOBUNAGA"><img src="https://www.gravatar.com/avatar/e772b59ce63734ea31a70ae3463607d1?d=identicon&amp;s=20" title="NOBUNAGA" alt="NOBUNAGA"></a>
<a class="display-all" href="https://metacpan.org/author/DBOEHMER"><img src="https://www.gravatar.com/avatar/220fbe10dba79664fe84771d5ea32763?d=identicon&amp;s=20" title="DBOEHMER" alt="DBOEHMER"></a>
<a class="display-all" href="https://metacpan.org/author/ILUX"><img src="https://www.gravatar.com/avatar/1cd0eea5e6ca13346060bb9d2c1e286b?d=identicon&amp;s=20" title="ILUX" alt="ILUX"></a>
</div>
<!-- Display counts of plussers-->
<div>
    <a href="https://metacpan.org/dist/TermReadKey/plussers">15 PAUSE users</a>
</div>
<div>
    6 non-PAUSE users
</div>
</div>
    </li>
    <li>
<div id="metacpan_contributors">
  <div>
    <button class="btn-link"
      onclick="$(this).hide(); $('#metacpan_contributors ul').slideDown(); return false;"
    >and 2 contributors</button>
  </div>
  <ul style="display: none">
    <li class="contributor"
    >
      Kenneth Albanowski
    </li>
    <li class="contributor"
    >
      Jonathan Stowe
    </li>
  </ul>
</div>
    </li>
              </ul>
            </div>
          </nav>
          <div class="content-navigation">
<div class="breadcrumbs">
  <span>
    <a data-keyboard-shortcut="g a" rel="author" href="https://metacpan.org/author/JSTOWE" class="author-name">Jonathan Stowe</a>
  </span>
  <span>&nbsp;/&nbsp;</span>
  <div class="release dist-release status-latest maturity-released">
    <span class="dropdown"><b class="caret"></b></span>
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/ReadKey.pm.PL&#39;" class="">
<option
  
  value="RURBAN/TermReadKey-2.38_03"
>2.38_03 DEV
  (RURBAN on 2019-06-17)</option>
<option
  selected
  value="JSTOWE/TermReadKey-2.38"
>2.38
  (JSTOWE on 2019-01-05)</option>
<option
  
  value="JSTOWE/TermReadKey-2.37"
>2.37
  (JSTOWE on 2016-10-07)</option>
<option
  
  value="JSTOWE/TermReadKey-2.36"
>2.36
  (JSTOWE on 2016-10-07)</option>
<option
  
  value="JSTOWE/TermReadKey-2.35"
>2.35
  (JSTOWE on 2016-10-06)</option>
<option
  
  value="JSTOWE/TermReadKey-2.34"
>2.34
  (JSTOWE on 2016-10-06)</option>
<option
  
  value="JSTOWE/TermReadKey-2.33"
>2.33
  (JSTOWE on 2015-06-04)</option>
<option
  
  value="STSI/TermReadKey-2.30.02"
>2.30.02
  (STSI on 2011-02-07)</option>
<option
  
  value="STSI/TermReadKey-2.30.01"
>2.30.01
  (STSI on 2008-06-24)</option>
<optgroup label="BackPAN">'
<option
  
  value="JSTOWE/TermReadKey-2.32"
>2.32
  (JSTOWE on 2014-05-10)</option>
<option
  
  value="JSTOWE/TermReadKey-2.31"
>2.31
  (JSTOWE on 2013-10-26)</option>
<option
  
  value="JSTOWE/TermReadKey-2.30"
>2.30
  (JSTOWE on 2005-01-12)</option>
<option
  
  value="JSTOWE/TermReadKey-2.21"
>2.21
  (JSTOWE on 2002-07-28)</option>
<option
  
  value="JSTOWE/TermReadKey-2.20"
>2.20
  (JSTOWE on 2002-05-24)</option>
<option
  
  value="JSTOWE/TermReadKey-2.19"
>2.19
  (JSTOWE on 2002-03-21)</option>
<option
  
  value="JSTOWE/TermReadKey-2.18"
>2.18
  (JSTOWE on 2002-02-10)</option>
<option
  
  value="JSTOWE/TermReadKey-2.17"
>2.17
  (JSTOWE on 2002-01-25)</option>
<option
  
  value="JSTOWE/TermReadKey-2.16"
>2.16
  (JSTOWE on 2001-11-29)</option>
<option
  
  value="JSTOWE/TermReadKey-2.15"
>2.15
  (JSTOWE on 2001-11-07)</option>
<option
  
  value="KJALB/TermReadKey-2.14"
>2.14
  (KJALB on 1999-03-29)</option>
<option
  
  value="KJALB/TermReadKey-2.13"
>2.13
  (KJALB on 1999-03-24)</option>
<option
  
  value="KJALB/TermReadKey-2.12"
>2.12
  (KJALB on 1998-01-07)</option>
<option
  
  value="KJALB/TermReadKey-2.11"
>2.11
  (KJALB on 1997-12-14)</option>
<option
  
  value="KJALB/TermReadKey-2.09"
>2.09
  (KJALB on 1997-10-07)</option>
<option
  
  value="KJALB/TermReadKey-2.08"
>2.08
  (KJALB on 1997-10-06)</option>
<option
  
  value="KJALB/TermReadKey-2.07"
>2.07
  (KJALB on 1997-01-27)</option>
<option
  
  value="KJALB/TermReadKey-2.06"
>2.06
  (KJALB on 1996-11-26)</option>
<option
  
  value="KJALB/TermReadKey-2.05"
>2.05
  (KJALB on 1996-03-14)</option>
<option
  
  value="KJALB/TermReadKey-2.04"
>2.04
  (KJALB on 1995-10-11)</option>
<option
  
  value="KJALB/TermReadKey-2.03"
>2.03
  (KJALB on 1995-09-29)</option>
</optgroup>
</select>
    <a data-keyboard-shortcut="g d" class="release-name" href="https://metacpan.org/dist/TermReadKey">TermReadKey-2.38</a>
  </div>
<span class="river-gauge-gauge">
  <svg width="24px"
       height="15px"
       version="1.1"
       xmlns="http://www.w3.org/2000/svg"
       xmlns:xlink="http://www.w3.org/1999/xlink">

    <g>
      <title>        River stage four &#10;
          • 168 direct dependents &#10;          • 1608 total dependents
      </title>

      <rect x="0"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="5"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="10"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="15"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="20"  y="0" width="4" height="15" fill="#e4e2e2" />
    </g>
  </svg>

</span>
<div id="TermReadKey-fav" class="logged_in">
<form action="https://metacpan.org/account/favorite/add" style="display: inline" onsubmit="return favDistribution(this)">
    <input type="hidden" name="remove" value="0">
    <input type="hidden" name="release" value="TermReadKey-2.38">
    <input type="hidden" name="author" value="JSTOWE">
    <input type="hidden" name="distribution" value="TermReadKey">
    <button type="submit" class="favorite highlight"><span>21</span> ++</button>
</form>
</div>
<div class="logged_out">
<a href="./Term::ReadKey.html" onclick="alert('Please sign in to add favorites'); return false" class="favorite highlight">
<span>21</span> ++</a>
</div>
   / <span>Term::ReadKey</span>
</div>
          </div>
          <main class="content">


<nav class="toc">
  <div class="toc-header"><strong>Contents</strong></div>
<ul>
  <li><a href="./Term::ReadKey.html#NAME">NAME</a></li>
  <li><a href="./Term::ReadKey.html#SYNOPSIS">SYNOPSIS</a></li>
  <li><a href="./Term::ReadKey.html#DESCRIPTION">DESCRIPTION</a></li>
  <li><a href="./Term::ReadKey.html#AUTHOR">AUTHOR</a></li>
  <li><a href="./Term::ReadKey.html#SUPPORT">SUPPORT</a></li>
  <li><a href="./Term::ReadKey.html#LICENSE">LICENSE</a></li>
</ul></nav>
<div class="pod anchors">
<h1 id="NAME">NAME</h1>

<p>Term::ReadKey - A perl module for simple terminal control</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<pre><code>    use Term::ReadKey;
    ReadMode 4; # Turn off controls keys
    while (not defined ($key = ReadKey(-1))) {
        # No key yet
    }
    print &quot;Get key $key\n&quot;;
    ReadMode 0; # Reset tty mode before exiting</code></pre>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p>Term::ReadKey is a compiled perl module dedicated to providing simple control over terminal driver modes (cbreak, raw, cooked, etc.,) support for non-blocking reads, if the architecture allows, and some generalized handy functions for working with terminals. One of the main goals is to have the functions as portable as possible, so you can just plug in &quot;use Term::ReadKey&quot; on any architecture and have a good likelihood of it working.</p>

<p>Version 2.30.01: Added handling of arrows, page up/down, home/end, insert/delete keys under Win32. These keys emit xterm-compatible sequences. Works with Term::ReadLine::Perl.</p>

<dl>

<dt id="ReadMode-MODE-[,-Filehandle]"><a id="ReadMode"></a><a id="ReadMode-MODE---Filehandle"></a>ReadMode MODE [, Filehandle]</dt>
<dd>

<p>Takes an integer argument or a string synonym (case insensitive), which can currently be one of the following values:</p>

<pre><code>    INT   SYNONYM    DESCRIPTION

    0    &#39;restore&#39;   Restore original settings.

    1    &#39;normal&#39;    Change to what is commonly the default mode,
                     echo on, buffered, signals enabled, Xon/Xoff
                     possibly enabled, and 8-bit mode possibly disabled.

    2    &#39;noecho&#39;    Same as 1, just with echo off. Nice for
                     reading passwords.

    3    &#39;cbreak&#39;    Echo off, unbuffered, signals enabled, Xon/Xoff
                     possibly enabled, and 8-bit mode possibly enabled.

    4    &#39;raw&#39;       Echo off, unbuffered, signals disabled, Xon/Xoff
                     disabled, and 8-bit mode possibly disabled.

    5    &#39;ultra-raw&#39; Echo off, unbuffered, signals disabled, Xon/Xoff 
                     disabled, 8-bit mode enabled if parity permits,
                     and CR to CR/LF translation turned off. </code></pre>

<p>These functions are automatically applied to the STDIN handle if no other handle is supplied. Modes 0 and 5 have some special properties worth mentioning: not only will mode 0 restore original settings, but it cause the next ReadMode call to save a new set of default settings. Mode 5 is similar to mode 4, except no CR/LF translation is performed, and if possible, parity will be disabled (only if not being used by the terminal, however. It is no different from mode 4 under Windows.)</p>

<p>If you just need to read a key at a time, then modes 3 or 4 are probably sufficient. Mode 4 is a tad more flexible, but needs a bit more work to control. If you use ReadMode 3, then you should install a SIGINT or END handler to reset the terminal (via ReadMode 0) if the user aborts the program via <code>^C</code>. (For any mode, an END handler consisting of &quot;ReadMode 0&quot; is actually a good idea.)</p>

<p>If you are executing another program that may be changing the terminal mode, you will either want to say</p>

<pre><code>    ReadMode 1;             # same as ReadMode &#39;normal&#39;
    system(&#39;someprogram&#39;);
    ReadMode 1;</code></pre>

<p>which resets the settings after the program has run, or:</p>

<pre><code>    $somemode=1;
    ReadMode 0;             # same as ReadMode &#39;restore&#39;
    system(&#39;someprogram&#39;);
    ReadMode 1;</code></pre>

<p>which records any changes the program may have made, before resetting the mode.</p>

</dd>
<dt id="ReadKey-MODE-[,-Filehandle]"><a id="ReadKey"></a><a id="ReadKey-MODE---Filehandle"></a>ReadKey MODE [, Filehandle]</dt>
<dd>

<p>Takes an integer argument, which can currently be one of the following values:</p>

<pre><code>    0    Perform a normal read using getc
    -1   Perform a non-blocked read
    &gt;0   Perform a timed read</code></pre>

<p>If the filehandle is not supplied, it will default to STDIN. If there is nothing waiting in the buffer during a non-blocked read, then undef will be returned. In most situations, you will probably want to use <code>ReadKey -1</code>.</p>

<p><i>NOTE</i> that if the OS does not provide any known mechanism for non-blocking reads, then a <code>ReadKey -1</code> can die with a fatal error. This will hopefully not be common.</p>

<p>If MODE is greater then zero, then ReadKey will use it as a timeout value in seconds (fractional seconds are allowed), and won&#39;t return <code>undef</code> until that time expires.</p>

<p><i>NOTE</i>, again, that some OS&#39;s may not support this timeout behaviour.</p>

<p>If MODE is less then zero, then this is treated as a timeout of zero, and thus will return immediately if no character is waiting. A MODE of zero, however, will act like a normal getc.</p>

<p><i>NOTE</i>, there are currently some limitations with this call under Windows. It may be possible that non-blocking reads will fail when reading repeating keys from more then one console.</p>

</dd>
<dt id="ReadLine-MODE-[,-Filehandle]"><a id="ReadLine"></a><a id="ReadLine-MODE---Filehandle"></a>ReadLine MODE [, Filehandle]</dt>
<dd>

<p>Takes an integer argument, which can currently be one of the following values:</p>

<pre><code>    0    Perform a normal read using scalar(&lt;FileHandle&gt;)
    -1   Perform a non-blocked read
    &gt;0   Perform a timed read</code></pre>

<p>If there is nothing waiting in the buffer during a non-blocked read, then undef will be returned.</p>

<p><i>NOTE</i>, that if the OS does not provide any known mechanism for non-blocking reads, then a <code>ReadLine 1</code> can die with a fatal error. This will hopefully not be common.</p>

<p><i>NOTE</i> that a non-blocking test is only performed for the first character in the line, not the entire line. This call will probably <b>not</b> do what you assume, especially with <code>ReadMode</code> MODE values higher then 1. For example, pressing Space and then Backspace would appear to leave you where you started, but any timeouts would now be suspended.</p>

<p><b>This call is currently not available under Windows</b>.</p>

</dd>
<dt id="GetTerminalSize-[Filehandle]"><a id="GetTerminalSize"></a><a id="GetTerminalSize--Filehandle"></a>GetTerminalSize [Filehandle]</dt>
<dd>

<p>Returns either an empty array if this operation is unsupported, or a four element array containing: the width of the terminal in characters, the height of the terminal in character, the width in pixels, and the height in pixels. (The pixel size will only be valid in some environments.)</p>

<p><i>NOTE</i>, under Windows, this function must be called with an <b>output</b> filehandle, such as <code>STDOUT</code>, or a handle opened to <code>CONOUT$</code>.</p>

</dd>
<dt id="SetTerminalSize-WIDTH,HEIGHT,XPIX,YPIX-[,-Filehandle]"><a id="SetTerminalSize"></a><a id="SetTerminalSize-WIDTH-HEIGHT-XPIX-YPIX---Filehandle"></a>SetTerminalSize WIDTH,HEIGHT,XPIX,YPIX [, Filehandle]</dt>
<dd>

<p>Return -1 on failure, 0 otherwise.</p>

<p><i>NOTE</i> that this terminal size is only for <b>informative</b> value, and changing the size via this mechanism will <b>not</b> change the size of the screen. For example, XTerm uses a call like this when it resizes the screen. If any of the new measurements vary from the old, the OS will probably send a SIGWINCH signal to anything reading that tty or pty.</p>

<p><b>This call does not work under Windows</b>.</p>

</dd>
<dt id="GetSpeed-[,-Filehandle]"><a id="GetSpeed"></a><a id="GetSpeed---Filehandle"></a>GetSpeed [, Filehandle]</dt>
<dd>

<p>Returns either an empty array if the operation is unsupported, or a two value array containing the terminal in and out speeds, in <b>decimal</b>. E.g, an in speed of 9600 baud and an out speed of 4800 baud would be returned as (9600,4800). Note that currently the in and out speeds will always be identical in some OS&#39;s.</p>

<p><b>No speeds are reported under Windows</b>.</p>

</dd>
<dt id="GetControlChars-[,-Filehandle]"><a id="GetControlChars"></a><a id="GetControlChars---Filehandle"></a>GetControlChars [, Filehandle]</dt>
<dd>

<p>Returns an array containing key/value pairs suitable for a hash. The pairs consist of a key, the name of the control character/signal, and the value of that character, as a single character.</p>

<p><b>This call does nothing under Windows</b>.</p>

<p>Each key will be an entry from the following list:</p>

<pre><code>        DISCARD
        DSUSPEND
        EOF
        EOL
        EOL2
        ERASE
        ERASEWORD
        INTERRUPT
        KILL
        MIN
        QUIT
        QUOTENEXT
        REPRINT
        START
        STATUS
        STOP
        SUSPEND
        SWITCH
        TIME</code></pre>

<p>Thus, the following will always return the current interrupt character, regardless of platform.</p>

<pre><code>        %keys = GetControlChars;
        $int = $keys{INTERRUPT};</code></pre>

</dd>
<dt id="SetControlChars-[,-Filehandle]"><a id="SetControlChars"></a><a id="SetControlChars---Filehandle"></a>SetControlChars [, Filehandle]</dt>
<dd>

<p>Takes an array containing key/value pairs, as a hash will produce. The pairs should consist of a key that is the name of a legal control character/signal, and the value should be either a single character, or a number in the range 0-255. SetControlChars will die with a runtime error if an invalid character name is passed or there is an error changing the settings. The list of valid names is easily available via</p>

<pre><code>        %cchars = GetControlChars();
        @cnames = keys %cchars;</code></pre>

<p><b>This call does nothing under Windows</b>.</p>

</dd>
</dl>

<h1 id="AUTHOR">AUTHOR</h1>

<p>Kenneth Albanowski &lt;kjahds@kjahds.com&gt;</p>

<p>Currently maintained by Jonathan Stowe &lt;jns@gellyfish.co.uk&gt;</p>

<h1 id="SUPPORT">SUPPORT</h1>

<p>The code is maintained at</p>

<pre><code>     https://github.com/jonathanstowe/TermReadKey</code></pre>

<p>Please feel free to fork and suggest patches.</p>

<h1 id="LICENSE">LICENSE</h1>

<p>Prior to the 2.31 release the license statement was:</p>

<pre><code> Copyright (C) 1994-1999 Kenneth Albanowski.
               2001-2005 Jonathan Stowe and others

               Unlimited distribution and/or modification is allowed as long as this
               copyright notice remains intact.</code></pre>

<p>And was only stated in the README file.</p>

<p>Because I believe the original author&#39;s intent was to be more open than the other commonly used licenses I would like to leave that in place. However if you or your lawyers require something with some more words you can optionally choose to license this under the standard Perl license:</p>

<pre><code>      This module is free software; you can redistribute it and/or modify it
      under the terms of the Artistic License. For details, see the full
      text of the license in the file &quot;Artistic&quot; that should have been provided
      with the version of perl you are using.

      This program is distributed in the hope that it will be useful, but
      without any warranty; without even the implied warranty of merchantability
      or fitness for a particular purpose.</code></pre></div>

<div id="metacpan_install-instructions-dialog" class="modal fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title">Module Install Instructions</h4>
      </div>
      <div class="modal-body">
        <p>To install Term::ReadKey, copy and paste the appropriate command in to your terminal.</p>
        <p><a href="https://metacpan.org/dist/App-cpanminus/view/bin/cpanm">cpanm</a></p>
        <pre><code>cpanm Term::ReadKey</code></pre>
        <p><a href="https://metacpan.org/pod/CPAN">CPAN shell</a></p>
        <pre><code>perl -MCPAN -e shell
install Term::ReadKey</code></pre>
        <p>For more information on module installation, please visit <a href="https://www.cpan.org/modules/INSTALL.html">the detailed CPAN module installation guide</a>.</p>
      </div>
      <div class="modal-footer">
        <a href="./Term::ReadKey.html#" data-dismiss="modal" class="btn">Close</a>
      </div>
    </div>
  </div>
</div>
          </main>
          <div class="content-pagination">
          </div>
        </div>
        <footer class="footer">
          <div class="footer-container">
            <div class="footer-social">
              <div class="footer-link footer-logo">
                <a href="https://metacpan.org/">
                  <img src="https://metacpan.org/static/images/metacpan-logo.svg" alt="MetaCPAN" />
                </a>
              </div>
              <a class="footer-social-link" href="https://github.com/metacpan">
                <i class="fab fa-github-square"></i>
              </a>
              <a class="footer-social-link" href="https://fosstodon.org/@metacpan">
                <i class="fab fa-mastodon"></i>
              </a>
            </div>
            <div class="footer-links">
              <div class="footer-link">
                  <a href="https://metacpan.org/about">About</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/sponsors">Sponsor</a>
              </div>
              <div class="footer-link">
                  <a href="https://grep.metacpan.org">grep::cpan</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/recent">Recent</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/faq">FAQ</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/tools">Tools</a>
              </div>
              <div class="footer-link">
                  <a href="https://fastapi.metacpan.org/">API</a>
              </div>
              <div class="footer-link">
                  <a href="https://www.perl.org/">Perl.org</a>
              </div>
            </div>
            <div class="footer-sponsors">
              <a class="footer-sponsor-link" target="_blank" href="https://www.bytemark.co.uk/" rel="noopener">
                <img class="footer-sponsor-bytemark" src="https://metacpan.org/static/images/sponsors/bytemark_logo.svg" alt="Bytemark logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.liquidweb.com/" rel="noopener">
                <img class="footer-sponsor-liquidweb" src="https://metacpan.org/static/images/sponsors/liquidweb_logo.png" alt="liquidweb logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://deriv.com/careers/" rel="noopener">
                <img class="footer-sponsor-deriv" src="https://metacpan.org/static/images/sponsors/deriv.svg" alt="Deriv logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://geocode.xyz" rel="noopener">
                <img class="footer-sponsor-geocode" src="https://metacpan.org/static/images/sponsors/geocodelogo.svg" alt="Geocode logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.fastly.com/" rel="noopener">
                <img class="footer-sponsor-fastly" src="https://metacpan.org/static/images/sponsors/fastly_logo.svg" alt="Fastly logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://opencagedata.com" rel="noopener">
                <img class="footer-sponsor-opencage" src="https://metacpan.org/static/images/sponsors/open-cage.svg" alt="OpenCage logo">
              </a>
            </div>
          </div>
        </footer>
        <div class="modal fade" tabindex="-1" role="dialog" id="metacpan_keyboard-shortcuts">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Keyboard Shortcuts</h4>
              </div>
              <div class="modal-body row">
<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Global</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>s</kbd>
        </td>
        <td>Focus search bar</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>?</kbd>
        </td>
        <td>Bring up this help dialog</td>
      </tr>
    </tbody>
  </table>

  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>GitHub</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>p</kbd>
        </td>
        <td>Go to pull requests</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>go to github issues (only if github is preferred repository)</td>
      </tr>
    </tbody>
  </table>
</div>

<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>POD</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>a</kbd>
        </td>
        <td>Go to author</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>c</kbd>
        </td>
        <td>Go to changes</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>Go to issues</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>d</kbd>
        </td>
        <td>Go to dist</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>r</kbd>
        </td>
        <td>Go to repository/SCM</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>s</kbd>
        </td>
        <td>Go to source</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>b</kbd>
        </td>
        <td>Go to file browse</td>
      </tr>

    </tbody>
  </table>
</div>

<div class="col-md-12">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Search terms</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><em>module:</em> (e.g. <a href="https://metacpan.org/search?q=module%3APlugin">module:Plugin</a>)</td>
      </tr>
      <tr>
        <td><em>distribution:</em> (e.g. <a href="https://metacpan.org/search?q=distribution%3ADancer+auth">distribution:Dancer auth</a>)</td>
      </tr>
      <tr>
        <td><em>author:</em> (e.g. <a href="https://metacpan.org/search?q=author%3ASONGMU+Redis">author:SONGMU Redis</a>)</td>
      </tr>
      <tr>
        <td><em>version:</em> (e.g. <a href="https://metacpan.org/search?q=version%3A1.00">version:1.00</a>)</td>
      </tr>
    </tbody>
  </table>
</div>
              </div>
              <div class="modal-footer"></div>
            </div>
          </div>
        </div>
    </body>
</html>
